// 处理路由的函数
export function getRouteItem(page, meta, custom) {
	return getInitRoute(page, meta, {
		useAnimation: true,
		useLoading: true,
		useCache: false,
		hideMenu: true,
		useTab: false,
		noAuth: true,
		...custom
	});
}

export function getMainRoute(page, meta, custom) {
	return getInitRoute(page, meta, {
		useAnimation: true,
		useLoading: true,
		useCache: true,
		hideMenu: false,
		useTab: true,
		noAuth: false,
		...custom
	});
}

function getInitRoute(page, meta, baseConfig) {
	const name = page
		.split('-')
		.map(str => $firstUpperCase(str))
		.join('');

	if (typeof meta === 'string') {
		meta = { ...baseConfig, label: meta, name };
	} else {
		meta = { ...baseConfig, ...meta, name };
	}
	return { path: `/${page}`, name, meta };
}